﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Stee.CAP8.ACL;

namespace SampleAPIService.Controllers
{
    //[ACLAnonymous]
    [ACLAuthorize("TestTask1")]
    [Route("[controller]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        private UserStore _store;
        public UserController( UserStore store)
        {
            _store = store;
        }

        [HttpGet]
        public IEnumerable<User> Get()
        {
            return _store.Users;
        }

        [HttpGet("{id}")]
        public User Get(int id)
        {
            return _store.Users.Where(q => q.Id == id).FirstOrDefault();
        }
    }
}